/*
 	弹出框对象
 	el:缓存创建的对象
 */
let Alert ={
	el :null,
	create :function(){
		let oDialog = document.createElement("div");
		oDialog.className ="dialog";
		oDialog.innerHTML = `<h3><a href="javascript:;" class="dialog-close">&times</a><span class="dialog-title"></span></h3>
			<div class="dialog-content"></div>
			<a href="javascript:;" class="dialog-confirm">确定</a>`
			this.el = oDialog;
			document.body.appendChild(oDialog);
		//添加关闭动作
		let oClose = oDialog.getElementsByClassName("dialog-close")[0];
		oClose.onclick =function(){
			this.hide();
		}.bind(this)
		//添加确定动作
		let oConfirm = oDialog.getElementsByClassName("dialog-confirm")[0];
		oConfirm.onclick =function(){
			this.hide();
		}.bind(this)
	},
	show :function({title:sTitle,content:sContent}={}){
		if(!this.el){
			this.create();
		}
		let oTitle = this.el.getElementsByClassName("dialog-title")[0];	
		oTitle.innerHTML = sTitle;
		let oContent = this.el.getElementsByClassName("dialog-content")[0];	
		oContent.innerHTML = sContent;

		
		this.el.style.display = "block"
	},
	hide :function(){
		this.el.style.display = "none";
	},
};
